//商户报备提交校验
function perform3101_freemypay() {
	var registrationNo = document.Form3101.registrationNo.value.trim();
	var merNature = $("#posSaleLevel").find("option:selected").text();
	var regNoEn = /^[0-9a-zA-Z]*$/; // 请输入数字或字母
	var regHanzi = /^[\u4e00-\u9fa5]+$/; // 请输入汉字
	var regCnEnNo = /^[a-zA-Z0-9\u4e00-\u9fa5（）、，。！-]+$/; // 可以输入中文英文和数字
	var regCnEn = /^[a-zA-Z\u4e00-\u9fa5]+$/;// 可以输入中文英文
	var regbank = /^[\d-]{9,30}$/;
	var regJinE = /^((0\.[0-9][0-9])|(0\.[0-9][0-9])|([1-9]{1}[0-9]{0,8}\.([0-9])[0-9])|(0))$/;
	var regterminalNum=/^(0|([1-9]\d*))$/;//大于等于0的整数
	var regfeerate=/^(0|([1-9][0-9]?|((0\.[0-9][0-9][0-9][0-9])|(0\.[0-9][0-9][0-9][0-9])|([1-9]{1}[0-9]?\.([0-9])[0-9][0-9][0-9])|(0))))$/;//大于0的两位数，若为小数，则必须保留两位
	var emailCheck = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;// 邮箱校验
	var ipCheck = /^(\d{1}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1}|1\d\d|2[0-4]\d|25[0-5])$/;//IP校验
	var regAmt = document.Form3101.regAmt.value.trim();
	var cusanMeenCheck =/^[A-Za-z]+$/;//商户英文名
	var regAddr = /^[a-zA-Z0-9\u4e00-\u9fa5-]+$/;
	var regSpecial1=/^[a-zA-Z0-9-()（）]+$/;
	var regSpecial2=/^[a-zA-Z0-9\u4e00-\u9fa5-()（）#]+$/;
	var regSpecial3=/^[a-zA-Z0-9\u4e00-\u9fa5()（）#]+$/;
	var bkAcNameCheck = /^[a-zA-Z0-9（）、()\u4e00-\u9fa5]+$/;
	var mernamesmCheck = /^[a-zA-Z0-9\u4e00-\u9fa5]{6,16}$/;
	var pho = /^(\d{3,4})-(\d{7,8})$/;//座机号正则表达式
	var tel =/^400-([0-9]){1}([0-9-]{7})$/;//400电话正则表达式
	var mpho =/^1(3|4|5|7|8)\d{9}$/;//手机号正则表达式
	//校验机具数量
	var terminalNum = /^([1]{1}[0-9]{3}|[1-9]{1}[0-9]{0,2}|(2000))$/;
	//校验现场注册标识
	var regMark=/^\d{25}$/;
	
	
	// 借记卡费率   
	var jfeerate=document.Form3101.jfeerate.value.trim();
	if(jfeerate == "" ){
		alert( "请输入借记卡费率！" ) ;
		document.Form3101.jfeerate.focus() ;
		return ;
	}else if(!regfeerate.test(jfeerate)){
		alert( "请输入正确的借记卡费率，必须为大于等于0小于100的数；若为小数，必须保留四位小数！" ) ;
		document.Form3101.jfeerate.focus() ;
		return ;
	}
	// 贷记卡费率   
	var dfeerate=document.Form3101.dfeerate.value.trim();
	if(dfeerate == "" ){
		alert( "请输入贷记卡费率！" ) ;
		document.Form3101.dfeerate.focus() ;
		return ;
	}else if(!regfeerate.test(dfeerate)){
		alert( "请输入正确的贷记卡费率，必须为大于等于0小于100的数；若为小数，必须保留四位小数！" ) ;
		document.Form3101.dfeerate.focus() ;
		return ;
	}
	// 机具金额
	var getTermAmt = document.Form3101.getTermAmt.value.trim();
	if ((document.Form3101.getTermType[0].checked || document.Form3101.getTermType[1].checked)&& getTermAmt == "") {
		alert("请输入机具金额！");
		document.Form3101.getTermAmt.focus();
		return;
	} else if (getTermAmt!="" && !regJinE.test(getTermAmt)) {
		alert("请输入正确机具金额,必须保留两位小数，可以为零！");
		document.Form3101.getTermAmt.focus();
		return;
	}
	// 商户经营地址(装机)
	var installAreaInf = $("#installAreaInfId").find("option:selected").text();//装机区域
	var installProvinceName = $("#installProvinceId").find("option:selected").text();//商户经营地址(装机)省份
	var installCityName = $("#installCityId").find("option:selected").text();//商户经营地址(装机)城市
	var installAreaName   = $("#installAreaId").find("option:selected").text();//商户经营地址(装机)县，区
	var installDetailAddr = document.Form3101.installDetailAddr.value.trim();//商户装机详细地址
	var installAreaInfId = document.Form3101.installAreaInfId.value.trim();//装机区域
	var installProvinceId = document.Form3101.installProvinceId.value.trim();//商户经营地址(装机)省份编码
	var installCityId = document.Form3101.installCityId.value.trim();//商户经营地址(装机)城市编码
	var installAreaId = document.Form3101.installAreaId.value.trim();//商户经营地址(装机)城市编码
	if(installAreaInfId == "onselect" || installAreaInfId == "" || installAreaInfId == null){
		alert( "请选择装机区域！" ) ;
		document.Form3101.installAreaInfId.focus() ;
		return ;
	}
	if(installProvinceId == "onselect" || installProvinceId == "" || installProvinceId == null){
		alert( "请选择商户经营地址(装机)省！" ) ;
		document.Form3101.installProvinceId.focus() ;
		return ;
	}
	if(installCityId == "onselect" || installCityId == "" || installCityId == null){
		alert( "请选择商户经营地址(装机)市！" ) ;
		document.Form3101.installCityId.focus() ;
		return ;
	}
	if(installDetailAddr == ""){
		alert( "请输入商户装机详细地址！" ) ;
		document.Form3101.installDetailAddr.focus() ;
		return ;
	}
	
	//商户装机地址县可选填，如果县为disabled，则可以不填，否则必填
	var areaDisabled = document.getElementById("installAreaId").getAttribute("disabled");
	if(areaDisabled!=null){
		if(!(areaDisabled='disabled'||areaDisabled)){//支持IE
			if (installAreaId == "onselect" || installAreaId == "" || installAreaId == null) {
				alert("请选择商户经营地址(装机)地区！");
				document.Form3101.installAreaId.focus();
				return;
			}
		}
	}else{
		if (installAreaId == "onselect" || installAreaId == "" || installAreaId == null) {
			alert("请选择商户经营地址(装机)地区！");
			document.Form3101.installAreaId.focus();
			return;
		}
	}
	if(areaDisabled!=null){
		if(areaDisabled='disabled'){//判断地区码是否为空，进行拼写商户注册地址
			if(installAreaName=='请选择区域'){
				document.getElementById("installAddr").value = installProvinceName + "-" + installCityName + "-" + installDetailAddr;
			}else{
				document.getElementById("installAddr").value = installProvinceName + "-" + installCityName + "-" + installAreaName + "-" + installDetailAddr;
			}
		}else{
			document.getElementById("installAddr").value = installProvinceName + "-" + installCityName + "-" + installAreaName + "-" + installDetailAddr;
		}
	}else{
		document.getElementById("installAddr").value = installProvinceName + "-" + installCityName + "-" + installAreaName + "-" + installDetailAddr;
	}
	
	if(!regSpecial3.test(installDetailAddr)){
		alert("商户经营地址(装机)只能输入汉字、英文、数字、括号、#");
		document.Form3101.installDetailAddr.focus() ;
		return ;
	}
	
	
	/*var installAddr = document.Form3101.installAddr.value.trim();
	if(installAddr == "" ){
		alert( "请输入商户装机地址！" ) ;
		document.Form3101.installAddr.focus() ;
		return ;
		}
	if (installAddr != "") {
		if (!regSpecial2.test(installAddr)) {
			alert("商户装机地址只能输入汉字、英文、数字、括号、#和连接符-");
			document.Form3101.installAddr.focus();
			return;
		}
	}*/
	// 机具数量
	/*if (document.Form3101.terminalNum.value.trim() == "") {
		alert("请输入机具数量！");
		document.Form3101.terminalNum.focus();
		return;
	} else if(!regterminalNum.test(document.Form3101.terminalNum.value.trim())){
		alert("机具数量必须为大于等于0的整数");
		document.Form3101.terminalNum.focus() ;
		return ;
	}*/
	/*var terminalNum=document.Form3101.terminalNum.value.trim();
	if(terminalNum == "" ){
		alert( "请输入机具数量" ) ;
		document.Form3101.terminalNum.focus() ;
		return ;
		}
	if( terminalNum !="" ){
		if(!regterminalNum.test(terminalNum)){
		alert("机具数量必须为大于等于0的整数");
		document.Form3101.terminalNum.focus() ;
		return ;
		}
	}*/
	
	//终端型号校验
	var modelNames = document.getElementsByName("modelNames");
	for(var i=0;i<modelNames.length;i++){
		if(modelNames[i].value=='onselect'||modelNames[i].value==''){
			if(i!=1){
				alert("请选择终端型号！");
				modelNames[i].focus();
				return;
			}
		}
	}
	for(var i=0;i<modelNames.length-1;i++){
		if(i==1){
			continue;
		}
		for(var j=i+1;j<modelNames.length;j++){
			if(modelNames[i].value.trim()==modelNames[j].value.trim()){
				alert("终端型号存在重复！");
				modelNames[i].focus();
				return;
			}
		}
	}
	//机具数量
	var terminalNums = document.getElementsByName("terminalNums");
	//SN号
	var snNumberNums = document.getElementsByName("snNumberNums");
	for(var i=0;i<terminalNums.length;i++){
		if(terminalNums[i].value==''){
			if(i!=1){
				alert("请输入机具数量！");
				terminalNums[i].focus();
				return;
			}
		}else{
			if(!terminalNum.test(terminalNums[i].value.trim())){
				alert("机具数量必须为大于0小于等于2000的正数！");
				terminalNums[i].focus();
				return;
			}
		}
		if(snNumberNums[i].value==''){
			if(i!=1){
				alert("请导入序列号！");
				return;
			}
		}
	}

	if (merNature == "企业") {
		if (regAmt == "") {
			alert("请输入注册资金！");
			document.Form3101.regAmt.focus();
			return;
		}
	}
	if (document.Form3101.regAmt.value.trim() != "") {
		if (!regJinE.test(regAmt)) {
			alert("请输入正确注册资金金额,必须保留两位小数，可以为零！");
			document.Form3101.regAmt.focus();
			return;
		}
	}

	if (merNature == "企业") {
		if (registrationNo == "") {
			alert("请输入组织机构代码！");
			document.Form3101.registrationNo.focus();
			return;
		}
	}
	if (document.Form3101.registrationNo.value.trim() != "") {
		if (!regSpecial1.test(registrationNo)) {
			alert("组织机构代码只能输入数字、字母、括号和连接符-");
			document.Form3101.registrationNo.focus();
			return;
		}
	}
	// 是否开通额外业务
	var addBusiness = $("#addBusiness").find("option:selected").text();
	$("#addBusiness1").text("");
	$("#addBusiness1").text(addBusiness);
	//现场注册标识
	var registrationMark = document.Form3101.registrationMark.value.trim();
	if(document.Form3101.registrationMark.value.trim() != ""){
		if(!regMark.test(registrationMark)){
			alert("现场注册标识只能为25位数字");
			document.Form3101.registrationMark.focus();
			return;
		}
	}
	var licenseNo = document.Form3101.licenseNo.value.trim();
	if (licenseNo == "") {
		alert("请输入营业执照号！");
		document.Form3101.licenseNo.focus();
		return;
	} else if (!regSpecial1.test(licenseNo)) {
		alert("营业执照号只能输入数字、字母、括号和连接符-");
		document.Form3101.licenseNo.focus();
		return;
	}
	var lawyer = document.Form3101.lawyer.value.trim();
	if (lawyer == "") {
		alert("请输入法人代表姓名！");
		document.Form3101.lawyer.focus();
		return;
	} else if (!regCnEn.test(lawyer)) {
		alert("法人代表姓名可以输入中文或字母");
		document.Form3101.lawyer.focus();
		return;
	}
	var regcertCode = /^[0-9a-zA-Z]*$/;
	var certCode = document.Form3101.certCode.value.trim();
	if (certCode == "") {
		alert("请输入法人代表证件号码！");
		document.Form3101.certCode.focus();
		return;
	} else if (!regcertCode.test(certCode)) {
		alert("法人代表证件号码必须为数字或字母！");
		document.Form3101.certCode.focus();
		return;
	}
	// 结算类型
	var cusanMeen = document.Form3101.cusanMeen.value;//结算类型
	if(cusanMeen==''){
		alert("请选择结算类型！");
		document.Form3101.cusanMeen.focus();
		return;
	}
	var settleIdNo = document.Form3101.settleIdNo.value.trim();//结算人身份证号校验
	if ((document.Form3101.cusanMeen[1].checked)&& settleIdNo == "") {
		alert("请输入结算人身份证号！");
		document.Form3101.settleIdNo.focus();
		return;
	} else if (settleIdNo!="" && !regcertCode.test(settleIdNo)) {
		alert("结算人身份证号号必须为数字或字母！");
		document.Form3101.settleIdNo.focus();
		return;
	}
	var bankName = document.Form3101.bankName.value.trim();
	if (bankName == "" || bankName == "onselect") {
		alert("请选择银行名称！");
		document.Form3101.bankName.focus();
		return;
	} 
	/*else if (!regCnEn.test(bankName)) {
		alert("银行名称可以输入中文或字母");
		document.Form3101.bankName.focus();
		return;
	}*/
	var bkAcId = document.Form3101.bkAcId.value.trim()
	if (bkAcId == "") {
		alert("请输入银行帐号！");
		document.Form3101.bkAcId.focus();
		return;
	} else if (!regbank.test(bkAcId)) {
		alert("银行账号为9-30位，全部为数字也可以包含-！");
		document.Form3101.bkAcId.focus();
		return;
	}

	var busiName = document.Form3101.busiName.value.trim();
	if (document.Form3101.busiName.value.trim() == "") {
		alert("请输入商户名称！");
		document.Form3101.busiName.focus();
		return;
	} else if (!bkAcNameCheck.test(busiName)) {
		alert("商户名称可以输入中文英文数字和括号！");
		document.Form3101.busiName.focus();
		return;
	}

	var majarBusi = document.Form3101.majarBusi.value.trim();
	if (document.Form3101.majarBusi.value.trim() == "") {
		alert("请输入主营业务！");
		document.Form3101.majarBusi.focus();
		return;
	} else if (!regCnEnNo.test(majarBusi)) {
		alert("主营业务可以输入中文英文数字和中文符号！");
		document.Form3101.majarBusi.focus();
		return;
	}
	var regHanzi = /^[\u4e00-\u9fa5]+$/;
	var linkMan = document.Form3101.linkMan.value.trim();
	if (linkMan == "") {
		alert("请输入商户联系人！");
		document.Form3101.linkMan.focus();
		return;
	} else if (!regHanzi.test(linkMan)) {
		alert("商户联系人必须为汉字");
		document.Form3101.linkMan.focus();
		return;
	}

	if (document.Form3101.mobileId.value.trim() == "") {
		alert("请输入商户联系电话(手机)！");
		document.Form3101.mobileId.focus();
		return;
	}
	if (!checkMp(document.Form3101.mobileId)) {
		alert("商户联系电话(手机)格式不正确！");
		document.Form3101.mobileId.focus();
		return;
	}
	
	//联系人地址
	var linkManProvinceName = $("#linkManProvinceId").find("option:selected").text();//联系人地址省份
	var linkManCityName = $("#linkManCityId").find("option:selected").text();//联系人地址城市
	var linkManAddr = document.Form3101.linkManAddr.value.trim();//联系人详细地址
	var linkManProvinceId = document.Form3101.linkManProvinceId.value.trim();//联系人地址省份编码
	var linkManCityId = document.Form3101.linkManCityId.value.trim();//联系人地址城市编码
	if(linkManProvinceId == "onselect" || linkManProvinceId == "" || linkManProvinceId == null){
		alert( "请选择联系人地址省！" ) ;
		document.Form3101.linkManProvinceId.focus() ;
		return ;
	}
	if(linkManCityId == "onselect" || linkManCityId == "" || linkManCityId == null){
		alert( "请选择联系人地址市！" ) ;
		document.Form3101.linkManCityId.focus() ;
		return ;
	}
	if(linkManAddr == ""){
		alert( "请输入联系人详细地址！" ) ;
		document.Form3101.linkManAddr.focus() ;
		return ;
	}
	if(!regSpecial2.test(linkManAddr)){
		alert( "联系人地址只能输入汉字、英文、数字、括号、#和连接符-" ) ;
		document.Form3101.linkManAddr.focus() ;
		return ;
	}else{
		$("#linkManTec1").text("");
		$("#linkManTec1").text(linkManProvinceName + "-" + linkManCityName + "-" + linkManAddr);
	}
	document.getElementById("linkManTec").value = linkManProvinceName + "-" + linkManCityName + "-" + linkManAddr;//拼联系人地址，供action接收
	/*var linkManTec = document.Form3101.linkManTec.value.trim();
	if (document.Form3101.linkManTec.value.trim() == "") {
		alert("请输入联系人地址！");
		document.Form3101.linkManTec.focus();
		return;
	} else if (!regSpecial2.test(linkManTec)) {
		alert( "联系人地址只能输入汉字、英文、数字、括号、#和连接符-" ) ;
		document.Form3101.linkManTec.focus();
		return;
	}*/
	/*var branceName = document.Form3101.branceName.value.trim();
	if (branceName != "") {
		if (!regCnEn.test(branceName)) {
			alert("支行名称可以输入中文或字母");
			document.Form3101.branceName.focus();
			return;
		}
	}*/
	
	var branceName = document.Form3101.branceName.value.trim();
	if (document.Form3101.branceName.value.trim() == "") {
		alert("请输入支行名称！");
		document.Form3101.branceName.focus();
		return;
	} else if (!regCnEn.test(branceName)) {
		alert("支行名称可以输入中文或字母！");
		document.Form3101.branceName.focus();
		return;
	}
	
	var bkAcName = document.Form3101.bkAcName.value.trim();
	
	if (document.Form3101.bkAcName.value.trim() == "") {
		alert("请输入银行户名！");
		document.Form3101.bkAcName.focus();
		return;
	} else if (!bkAcNameCheck.test(bkAcName)) {
		alert("银行户名可以输入中文英文数字和括号！");
		document.Form3101.bkAcName.focus();
		return;
	}
	var contrId = document.Form3101.contrId.value.trim();
	if(contrId == ""){
		alert("协议编号不能为空");
		document.Form3101.contrId.focus();
		return;
	}else if (!regSpecial1.test(contrId)) {
		alert("协议编号只能输入数字、字母、括号和连接符-");
		document.Form3101.contrId.focus();
		return;
	}
	var remark = document.Form3101.remark.value.trim();
	if (remark != "") {
		if (!regCnEnNo.test(remark)) {
			alert("备注可以输入中文英文和数字");
			document.Form3101.remark.focus();
			return;
		}
	}
	var mernamesm = document.Form3101.mernamesm.value.trim();
	if (document.Form3101.mernamesm.value.trim() == "") {
		alert("请输入商户简称！");
		document.Form3101.mernamesm.focus();
		return;
	} else if (!mernamesmCheck.test(mernamesm)) {
		alert("商户简称可以输入6-16位的中文英文数字！");
		document.Form3101.mernamesm.focus();
		return;
	}
	
	var empoNum = document.Form3101.empoNum.value.trim();
	if (document.Form3101.empoNum.value.trim() == "") {
		alert("请输入员工数量！");
		document.Form3101.empoNum.focus();
		return;
	} else if (!isNumber(empoNum)) {
		alert("员工数量必须为数字");
		document.Form3101.empoNum.focus();
		return;
	}
	//开户地/商户注册地址
	var openProvName = $("#openProvinceId").find("option:selected").text();//开户地省份
	var openAreaName = $("#openCityId").find("option:selected").text();//开户地城市
	var merAddr = document.Form3101.merAddr.value.trim();//商户注册地址的详细内容
	var merProvName = $("#merProvinceId").find("option:selected").text();//商户注册地址省份
	var merCityName = $("#merCityId").find("option:selected").text();//商户注册地址城市
	var merAreaName = $("#merAreaId").find("option:selected").text();//商户注册地址地区
	var openProvinceId = $('#openProvinceId option[selected]').val();//得到开户地省份编码
	if (openProvinceId == "onselect" || openProvinceId == "" || openProvinceId == null) {
		alert("请选择开户省！");
		document.Form3101.openProvinceId.focus();
		return;
	}
	var openCityId = $('#openCityId option[selected]').val();//得到开户地城市编码
	if (openCityId == "onselect" || openCityId == "" || openCityId == null) {
		alert("请选择开户市！");
		document.Form3101.openCityId.focus();
		return;
	}
	document.getElementById('addressChn').value = openProvName + "-"+ openAreaName;//开户地省市编码拼写
	var merProvinceId = document.Form3101.merProvinceId.value;//得到商户注册地址省份编码
	if (merProvinceId == "onselect" || merProvinceId == "" || merProvinceId == null) {
		alert("请选择商户注册地址省份！");
		document.Form3101.merProvinceId.focus();
		return;
	}
	var merCityId = document.Form3101.merCityId.value;//得到商户注册地址城市编码
	if (merCityId == "onselect" || merCityId == "" || merCityId == null) {
		alert("请选择商户注册地址城市！");
		document.Form3101.merCityId.focus();
		return;
	}
	var merAreaId = document.Form3101.merAreaId.value;//得到商户注册地址地区编码
	//var merOptionNum = document.getElementById("merAreaId").childNodes.length;
	var nodeDisabled = document.getElementById("merAreaId").getAttribute("disabled");
	if(nodeDisabled!=null){
		if(!(nodeDisabled='disabled'||nodeDisabled)){//支持IE
			if (merAreaId == "onselect" || merAreaId == "" || merAreaId == null) {
				alert("请选择商户注册地址地区！");
				document.Form3101.merAreaId.focus();
				return;
			}
		}
	}else{
		if (merAreaId == "onselect" || merAreaId == "" || merAreaId == null) {
			alert("请选择商户注册地址地区！");
			document.Form3101.merAreaId.focus();
			return;
		}
	}
	if( document.Form3101.merAddr.value.trim() == "" ){
		alert( "请输入商户注册地址的详细地址！" ) ;
		document.Form3101.merAddr.focus() ;
		return ;
	}else if(!regSpecial2.test(merAddr)){
		alert( "商户注册地址的详细地址只能输入汉字、英文、数字、括号、#和连接符-" ) ;
		document.Form3101.merAddr.focus() ;
		return ;
	}
	if(nodeDisabled!=null){
		if(nodeDisabled='disabled'){//判断地区码是否为空，进行拼写商户注册地址
			if(merAreaName=='请选择区域'){
				document.getElementById("busiAddr").value = merProvName + "-" + merCityName + "-" + merAddr;
			}else{
				document.getElementById("busiAddr").value = merProvName + "-" + merCityName + "-" + merAreaName + "-" + merAddr;
			}
		}else{
			document.getElementById("busiAddr").value = merProvName + "-" + merCityName + "-" + merAreaName + "-" + merAddr;
		}
	}else{
		document.getElementById("busiAddr").value = merProvName + "-" + merCityName + "-" + merAreaName + "-" + merAddr;
	}
	
	/*var busiAddr = document.Form3101.busiAddr.value.trim();
	if (document.Form3101.busiAddr.value.trim() == "") {
		alert("请输入商户注册地址！");
		document.Form3101.busiAddr.focus();
		return;
	} else if (!regSpecial2.test(busiAddr)) {
		alert("商户注册地址为1-60位，只能输入汉字、英文、数字、括号、#和连接符-");
		document.Form3101.busiAddr.focus();
		return;
	}
	var addressChn = document.Form3101.addressChn.value.trim();
	if (document.Form3101.addressChn.value.trim() == "") {
		alert("请输入开户地！");
		document.Form3101.addressChn.focus();
		return;
	} else if (!regSpecial2.test(addressChn)) {
		alert("开户地地址为1-30位，只能输入汉字、英文、数字、括号、#和连接符-");
		document.Form3101.addressChn.focus();
		return;
	}*/

	var linkTelEmail = document.Form3101.linkTelEmail.value.trim();
	if (document.Form3101.linkTelEmail.value.trim() != "") {
		if (!emailCheck.test(linkTelEmail)) {
			alert("联系人邮箱格式不正确！");
			document.Form3101.linkTelEmail.focus();
			return;
		}
	}

	if (document.Form3101.zipCd.value.length != 0) {
		if (document.Form3101.zipCd.value.length != 6
				|| !isNumber(document.Form3101.zipCd)) {
			alert("邮编格式错误！");
			document.Form3101.zipCd.focus();
			return;
		}
	} 
	/*else {
		alert("邮编不能为空！");
		document.Form3101.zipCd.focus();
		return;
	}*/
	var telPhone = document.Form3101.telPhone.value.trim();
	var reg = /^(\d{3,4})-(\d{7,8})$/;
	if (telPhone != "" && telPhone != null) {
		if (!reg.test(telPhone)) {
			alert("商户联系电话(固话)格式为:区号(3-4位)-电话号码(7-8位)！");
			document.Form3101.telPhone.focus();
			return;
		}
	}

	if (document.Form3101.dateOpen.value.trim() == "") {
		alert("请输入成立日期！");
		document.Form3101.dateOpen.focus();
		return;
	}
	
	// 复选框
	var modelType = "";
	var models = document.getElementsByName("model");
	for ( var i = 0; i < models.length; i++) {
		if (models[i].checked) { // 判断复选框是否选中
			modelType = modelType + models[i].value; // 值的拼凑 .. 具体处理看你的需要,
		}
	}
	document.getElementById("modelType").value = modelType;
	if (modelType.length == '0') {
		alert("请选择机具类型");
		return;
	}
	//提现类型单选
	/*var withdrawType=$('input[name="withdrawType"]:checked').val();
	if(withdrawType==null||withdrawType==""){
		alert("请选择提现类型");
		return;
	}*/
	var withdrawType = "";
	var withdraws = document.getElementsByName("withdraw");
	for(var i = 0; i < withdraws.length; i++){
		/*if (withdraws[i].checked) { // 判断复选框是否选中
			//withdrawType = withdrawType + withdraws[i].value+","; // 值的拼凑 .. 具体处理看你的需要,
			
		}*/
		if (withdraws[i].checked) { // 判断复选框是否选中
			withdrawType = withdrawType + withdraws[i].value+","; // 值的拼凑 .. 具体处理看你的需要,
			if(withdraws[i].value=="D0"){
				if($("#rateD0").val()==""){
					alert("请输入D0费率(%)");
					return;
				}
				if($("#rateD0").val()<"0.02"){
					alert("D0费率不能低于0.02%");
					return;
				}
				if (document.Form3101.loginTel.value.trim() == "") {
					alert("请输入登录手机号！");
					document.Form3101.loginTel.focus();
					return;
				}
				if (!checkMp(document.Form3101.loginTel)) {
					alert("登记手机号格式不正确！");
					document.Form3101.loginTel.focus();
					return;
				}
		}
			if(withdraws[i].value=="D1"){
				if($("#rateD1").val()==""){
					alert("请输入D1费率(%)");
					return;
				}
				if(!document.Form3101.isDiscount[0].checked&&!document.Form3101.isDiscount[1].checked){
					alert("必须选择是否参与优惠活动！");
					document.Form3101.isDiscount.focus();
					return;
				}
				if (document.Form3101.loginTel.value.trim() == "") {
					alert("请输入登录手机号！");
					document.Form3101.loginTel.focus();
					return;
				}
				if (!checkMp(document.Form3101.loginTel)) {
					alert("登记手机号格式不正确！");
					document.Form3101.loginTel.focus();
					return;
				} 
	    }
	}
	}
	
	// 商户类别
	var hyType = $("#hyType").find("option:selected").val();
	//进行验证标准类是否包含（商户类别的标准类、其他类）,减免类是否包含（非营利性医疗机构、非营利性教育机构、非营利性慈善及社会福利机构），优惠类包含（除标准类和减免类包含的）。
	//申请商户类别
	if (document.Form3101.applyShType[1].checked) {
		if("15"!=hyType && "16"!=hyType && "17"!=hyType && "18"!=hyType){
    	  	alert("您填写的商户所属的行业类别不能申请成为商户申请的商户类别");
    	  	document.Form3101.hyType.focus();
			return;
    	  }
	}
	
	 if (document.Form3101.applyShType[2].checked) {
		if("19"!=hyType && "20"!=hyType && "21"!=hyType){
    	  	alert("您填写的商户所属的行业类别不能申请成为商户申请的商户类别");
    	  	document.Form3101.hyType.focus();
			return;
    	  }
	}
	
	var newwithdrawType = withdrawType.substring(0,withdrawType.length-1);
	document.getElementById("withdrawType").value = newwithdrawType;
	/*if(withdrawType.length=='0'){
		alert("请选择提现类型");
		return;
	}*/
	//预授权
	var preState="";
	var preStates = document.getElementsByName("preStateType");
	if (preStates[0].checked) { // 判断复选框是否选中
		preState = preStates[0].value; 
		document.getElementById("preState").value = preState;
	}else{
		preState = "1" ;
		document.getElementById("preState").value = preState;
	}
	
	var phone =document.getElementById("phone").value;//扫码付产品客服电话
	if (phone != "" && phone != null) {
		if (!pho.test(phone) && !tel.test(phone) && !mpho.test(phone)) {
			alert("客服电话有误！");
			document.Form3101.phone.focus();
			return;
		}
	}
	
	var alipay = document.getElementById("alipay");
	if(alipay.checked){
		var alipayOneId = $("#alipayOneId").find("option:selected").text();//支付宝一级类目
		var alipayTwoId = $("#alipayTwoId").find("option:selected").text();//支付宝二级类目
		var alipayThreeId = $("#alipayThreeId").find("option:selected").text();//支付宝三级类目
		var arate =document.getElementById("arate").value;//支付宝费率
		if(alipayOneId=="一级类目"){
			alert("请选择支付宝经营类目");
			document.Form3101.alipayOneId.focus();
			return;
		}else if(alipayTwoId=="二级类目"){
			alert("请选择支付宝经营类目");
			document.Form3101.alipayTwoId.focus();
			return;
		}else if(alipayThreeId=="三级类目"){
			alert("请选择支付宝经营类目");
			document.Form3101.alipayThreeId.focus();
			return;
		}
		if(arate ==""){
			alert("支付宝费率不能为空");
			document.Form3101.arate.focus();
			return;
		}else if (!regfeerate.test(arate)) {
			alert("请输入正确的费率，必须为大于等于0小于100的数；若为小数，必须保留四位小数！");
			document.Form3101.arate.focus();
			return;
		}
	}
	
	var wechat = document.getElementById("wechat");
	if(wechat.checked){
		var wechatOneId = $("#wechatOneId").find("option:selected").text();//微信一级类目
		var wechatTwoId = $("#wechatTwoId").find("option:selected").text();//微信二级类目
		var wechatThreeId = $("#wechatThreeId").find("option:selected").text();//微信三级类目
		var wrate =document.getElementById("wrate").value;//微信费率
		if(wechatOneId =="一级类目"){
			alert("请选择微信经营类目");
			document.Form3101.wechatOneId.focus();
			return;
		}else if(wechatTwoId =="二级类目"){
			alert("请选择微信经营类目");
			document.Form3101.wechatTwoId.focus();
			return;
		}else if(wechatThreeId =="三级类目"){
			alert("请选择微信经营类目");
			document.Form3101.wechatThreeId.focus();
			return;
		}
		if(wrate ==""){
			alert("微信费率不能为空");
			document.Form3101.wrate.focus();
			return;
		}else if (!regfeerate.test(wrate)) {
			alert("请输入正确的费率，必须为大于等于0小于100的数；若为小数，必须保留四位小数！");
			document.Form3101.wrate.focus();
			return;
		}
	}
	
	var oneYardPay = document.getElementById("oneYardPay");
	var umfcode = document.getElementById("umfcode");
	if(oneYardPay.checked){
		if(!umfcode.checked&&!wechat.checked&&!alipay.checked){
			alert("开通一码付必须选择微信和支付宝或联动扫码！");
			return;
		}
		if((wechat.checked&&!alipay.checked)||(!wechat.checked&&alipay.checked)){
			alert("开通一码付必须同时开通支付宝与微信！");
			return;
		}
	}
	
	if(umfcode.checked){
		var crate =document.getElementById("crate").value;//联动扫码费率
		if(!oneYardPay.checked){
			alert("开通联动扫码必须勾选一码付");
			document.Form3101.crate.focus();
			return;
		}
		if(crate ==""){
			alert("联动扫码费率不能为空");
			document.Form3101.crate.focus();
			return;
		}else if (!regfeerate.test(crate)) {
			alert("请输入正确的费率，必须为大于等于0小于100的数；若为小数，必须保留四位小数！");
			document.Form3101.crate.focus();
			return;
		}else if(crate<0.3){
			alert("联动扫码费率不能低于0.3%");
			document.Form3101.crate.focus();
			return;
		}else if(document.Form3101.loginTel.value.trim() == ""){
			alert("登录手机号不能为空!");
			document.Form3101.loginTel.focus();
			return;
		}
	}
	//商户E-mail
	var email = document.Form3101.email.value.trim();
	if (document.Form3101.email.value.trim() != "") {
		if (!emailCheck.test(email)) {
			alert("商户E-mail格式不正确！");
			document.Form3101.email.focus();
			return;
		}
	}
	//IP地址
	var serverIP = document.Form3101.serverIP.value.trim();
	if (document.Form3101.serverIP.value.trim() != "") {
		if (!ipCheck.test(serverIP)) {
			alert("IP地址格式不正确！");
			document.Form3101.serverIP.focus();
			return;
		}
	}
	//商户英文名
//	var cusanMeen = document.Form3101.cusanMeen.value.trim();
//	if (document.Form3101.cusanMeen.value.trim() != "") {
//		if (!cusanMeenCheck.test(cusanMeen)) {
//			alert("商户英文名格式不正确！");
//			document.Form3101.cusanMeen.focus();
//			return;
//		}
//	}
	//商户经营地区范围,若是个别省的话就取具体的哪个省
	if(document.Form3101.occurArea[1].checked){
		var occurArea=$("#occurArea").val();
		if(occurArea==null){
			alert("商户经营地区范围不能为空!");
			document.Form3101.occurArea1.focus();
			return;
		}
	}
	document.Form3101.submit();
	document.Form3101.merAdd.disable = true;
}
